<?php


use Elasticsearch\ClientBuilder;

class EsModel
{
    protected function getEsClient()
    {
        $client = ClientBuilder::create()->setHosts([$this->getEsClient()])
            ->setConnectionPool('\Elasticsearch\ConnectionPool\SimpleConnectionPool', [])
            ->setRetries(10)->build();
        return $client;
    }

    protected function getEsConfig()
    {
        $config = [
            'host'      => '127.0.0.1',
            'port'      => '8200',
            'scheme'    => 'http',
            'user'      => 'root',
            'pass'      => '123456',
        ];

        return $config;
    }
}